package org.epanetgrid.otimizacao.tui;

import java.util.HashMap;
import java.util.HashSet;
import java.util.Set;



public class ArgOptions {

	public static final String TAM_POP_INICIAL = "tamPopInicial";
	public static final String POP_EXT = "popExt";
	public static final String ELITISMO = "elitismo";
	public static final String PORC_XO_NORMAL = "porcXOnormal";
	public static final String PROB_XO_NORMAL = "probXOnornal";
	public static final String PROB_XO_DIRECIONADO = "probXOdirecionado";
	public static final String PROB_MUT_NORMAL_INTERVALO = "probMutNormalIntervalo";
	public static final String PROB_MUT_NORMAL_BIT = "probMutNormalBit";
	public static final String PROB_MUT_DIRECIONADA = "probMutDirecionada";
	public static final String BOMBAS_MUTADAS = "bombasMutadas";
	public static final String GRID = "grid";
	public static final String CONTROLE_INICIAL = "controleInicial";
	public static final String MUTACAO = "mutacao";
	public static final String MUTACAO_INTERVALO = "intervalo";
	public static final String MUTACAO_BITABIT = "bitabit";
	public static final String SELECAO = "selecao";
	public static final String SELECAO_TORNEIO = "torneio";
	public static final String SELECAO_SUS = "sus";
	public static final String REPRESENTATIVAS = "representativas";
	public static final String FO = "fo";
	public static final String FO_CUSTO_TOTAL = "custototal";
	public static final String FO_CHAVEAMENTOS = "chaveamentos";
	public static final String FO_NIVEIS = "niveis";
	public static final String MAX_GERACOES = "maxGeracoes";
	public static final String MIN_VIAVEIS = "minViaveis";
	public static final String TEMPO_MAX = "tempoMax";
	public static final String PLANILHA_XLS = "planilha";
	public static final String LOG = "log";
	
	private HashSet<String> options;
	private HashMap<String, String> optionsValue;
	private HashMap<String, String[]> optionsValues;
	private HashSet<String> keys;
	private HashSet<String> keysWithValue;
	private HashSet<String> keysWithValues;
	private String networkFile;
	private String operacaoFile;
	
	public ArgOptions() {
		this.options = new HashSet<String>();
		this.optionsValue = new HashMap<String, String>();
		this.optionsValues = new HashMap<String, String[]>();
		this.keys = new HashSet<String>();
		this.keysWithValue = new HashSet<String>();
		this.keysWithValues = new HashSet<String>();
		
		this.keysWithValue.add(TAM_POP_INICIAL);
		this.keysWithValue.add(POP_EXT);
		this.keysWithValue.add(ELITISMO);
		this.keysWithValue.add(PORC_XO_NORMAL);
		this.keysWithValue.add(PROB_XO_NORMAL);
		this.keysWithValue.add(PROB_XO_DIRECIONADO);
		this.keysWithValue.add(PROB_MUT_NORMAL_INTERVALO);
		this.keysWithValue.add(PROB_MUT_NORMAL_BIT);
		this.keysWithValue.add(PROB_MUT_DIRECIONADA);
		this.keysWithValue.add(BOMBAS_MUTADAS);
		this.keysWithValue.add(GRID);
		this.keysWithValue.add(CONTROLE_INICIAL);
		this.keysWithValue.add(MUTACAO);
//		this.keys.add(MUTACAO_INTERVALO);
//		this.keys.add(MUTACAO_BITABIT);
		this.keysWithValue.add(SELECAO);
//		this.keys.add(SELECAO_TORNEIO);
//		this.keys.add(SELECAO_SUS);
		this.keysWithValue.add(REPRESENTATIVAS);
		this.keysWithValues.add(FO);
//		this.keys.add(FO_CUSTO_TOTAL);
//		this.keys.add(FO_CHAVEAMENTOS);
//		this.keys.add(FO_NIVEIS);
		this.keysWithValue.add(MAX_GERACOES);
		this.keysWithValue.add(MIN_VIAVEIS);
		this.keysWithValue.add(TEMPO_MAX);
		this.keysWithValue.add(PLANILHA_XLS);
		this.keysWithValue.add(LOG);

	}
	
	public void setOption(String option, String value) {
		optionsValue.put(option, value);
	}

	public void setOption(String option, String[] values) {
		optionsValues.put(option, values);
	}
	
	public void setHasOption(String option) {
		options.add(option);
	}
	
	public String getOptionValue(String option) {
		return optionsValue.get(option);
	}
	
	public String[] getOptionValues(String option) {
		return optionsValues.get(option);
	}
	
	public boolean hasOption(String option) {
		return options.contains(option)
			|| optionsValues.containsKey(option)
			|| optionsValue.containsKey(option);
	}

	public Set<String> getOptions() {
		return keys;
	}
	
	public Set<String> getOptionsWithValue() {
		return keysWithValue;
	}
	
	public Set<String> getOptionsWithValues() {
		return keysWithValues;
	}
	
	public void setNetworkFile(String networkFile) {
		this.networkFile = networkFile;
	}
	
	public void setOperacaoFile(String operacaoFile) {
		this.operacaoFile = operacaoFile;
	}
	
	public String getNetworkFile() {
		return this.networkFile;
	}
	
	public String getOperacaFile() {
		return this.operacaoFile;
	}
	
}